<%-- 
    Document   : usuarios
    Created on : 8/09/2014, 11:13:23 AM
    Author     : Jorge
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
        <jsp:useBean id="con" class="metodo.ap" scope="page"></jsp:useBean>
        <%
            ResultSet rs = con.paciente();
            try {
                if (!rs.next()) {
                    out.print("No se encontraron usuarios registrados");
                } else {
                    out.print("[");
                    do {
                        out.print("{");
                        out.print("\"id_usuario\":\""+rs.getString(1)+"\",");
                        out.print("\"usuario\":\""+rs.getString(2)+"\",");
                        out.print("\"apellido\":\""+rs.getString(6)+"\",");
                        out.print("\"correo\":\""+rs.getString(4)+"\",");
                        out.print("\"direccion\":\""+rs.getString(5)+"\",");
                        out.print("\"cedula\":\""+rs.getString(7)+"\",");
                        out.print("\"rfc\":\""+rs.getString(8)+"\",");
                        out.print("\"edad\":\""+rs.getString(9)+"\",");
                        out.print("\"tipo\":\""+rs.getString(10)+"\",");
                        out.print("\"sexo\":\""+rs.getString(11)+"\"");
                        if (!rs.isLast()) {
                            out.print("},");
                        } else {
                            out.print("}");
                        }
                    } while (rs.next());
                        out.print("]");
                    }
                }
                catch(Exception e)
      {
           out.print("Error al consultar: " + e);
      }
        %>